﻿

CREATE TRIGGER tr_Page_Delete
ON dbo.t_Page
FOR DELETE
AS

DECLARE @PageNumber int,@ImageID int

SELECT @PageNumber = PageNumber,
			 @ImageID = ImageID
FROM deleted

UPDATE t_Page SET PageNumber = PageNumber-1
WHERE ImageID = @ImageID AND PageNumber > @PageNumber



